﻿using System;
using System.Collections.Generic;
using System.Text;
using Mang24k99.Model.Dissertation;

namespace Mang24k99.Business.Dissertation
{
    public partial class BDissertationToNews
    {
        public static long ExsitNews(string newsID, string disID,int x)
        {
            MDissertations dis = MDissertations.Find(int.Parse(disID));
            string dissubtype = x.ToString();
            MDissertationToNews anews = MDissertationToNews.ExsitNews2(newsID, dis,dissubtype);
            if (anews != null)
                return anews.RecordID;
            else
                return 0;
        }

        /// <summary>
        /// 根据新闻ID与专题ID返回一个子实体
        /// </summary>
        /// <param name="newsid">新闻ID</param>
        /// <param name="disid">专题ID</param>
        /// <returns></returns>
        public static MDissertationToNews Find(string newsid, string disid)
        {
            MDissertations dis = MDissertations.Find(int.Parse(disid));
            return MDissertationToNews.ExsitNews(newsid, dis);
        }

        public static bool Delete(MDissertationToNews aNews)
        {
            aNews.BDeleted = 0;
            aNews.DeleteTime = DateTime.Now;
            aNews.UpdateAndFlush();
            return true;
        }
    }
}
